package com.example.kafka.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;


/**
 * @author Liyuhang
 * @Classname ExecutorConfig
 * @Description 定时任务线程池
 * @Date 2020/12/14 下午3:04
 */
@Configuration
@Slf4j
public class ExecutorConfig {

    /**
     * @Description: 定时任务调度器
     * @Author: LiYuhang
     */
    @Bean
    public TaskScheduler scheduledExecutorService() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(10);
        scheduler.setThreadNamePrefix("custom-scheduled-");
        return scheduler;
    }


}